<<<<<<< HEAD
/*
 * @Author: Xia_cc 978487464@qq.com
 * @Date: 2022-06-07 09:43:34
 * @LastEditors: Xia_cc 978487464@qq.com
 * @LastEditTime: 2022-06-10 16:33:12
 * @FilePath: \vue 小U到家\src\utils\axios.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import axios from "axios";
// import store from "./../store";
// const ConfigBaseUrl = "http://172.16.110.224:8080";

//使用create方法创建axios实例
const Service = axios.create({
  baseURL: "/api", //设置默认地址
  timeout: 5000, //设置超时
});
//给post请求添加请求头设置(不同项目值不同)
Service.defaults.headers.post["Content-Type"] = "application/json;Charset=utf-8";
//添加请求拦截器
Service.interceptors.request.use((config) => {
  console.log("axios的请求拦截");
  console.log(config);
  //请求头带token
  config.headers["token"] = window.localStorage.getItem("token");
  return config;
});
//添加响应拦截器
Service.interceptors.response.use(
  (response) => {
    console.log("axios的响应拦截");
    console.log(response);
    return response;
  },
  (error) => {
    return Promise.reject(error);
  }
);
export default Service;
=======
/*
 * @Author: Xia_cc 978487464@qq.com
 * @Date: 2022-06-07 09:43:34
 * @LastEditors: Xia_cc 978487464@qq.com
 * @LastEditTime: 2022-06-10 16:33:12
 * @FilePath: \vue 小U到家\src\utils\axios.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import axios from "axios";
// import store from "./../store";
// const ConfigBaseUrl = "http://172.16.110.224:8080";

//使用create方法创建axios实例
const Service = axios.create({
  baseURL: "/api", //设置默认地址
  timeout: 5000, //设置超时
});
//给post请求添加请求头设置(不同项目值不同)
Service.defaults.headers.post["Content-Type"] = "application/json;Charset=utf-8";
//添加请求拦截器
Service.interceptors.request.use((config) => {
  console.log("axios的请求拦截");
  console.log(config);
  //请求头带token
  config.headers["token"] = window.localStorage.getItem("token");
  return config;
});
//添加响应拦截器
Service.interceptors.response.use(
  (response) => {
    console.log("axios的响应拦截");
    console.log(response);
    return response;
  },
  (error) => {
    return Promise.reject(error);
  }
);
export default Service;
>>>>>>> ae27e4fe2d4f939d0b0ee2bfa506b9e3269c53cb
